package com.loyal.loyalerp.humenresource.employee.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.loyal.loyalerp.humenresource.employee.data.vo.Gy_PersonVo;
import com.loyal.loyalerp.humenresource.employee.entity.Gy_Person;
import com.loyal.loyalerp.humenresource.employee.mapper.Gy_PersonMapper;
import com.loyal.loyalerp.humenresource.employee.service.Gy_PersonWriteService;
import com.loyal.loyalerp.mapper.KaoQinMapper;

@Service
public class Gy_PersonWriteServiceImpl implements Gy_PersonWriteService{
	
	@Autowired
	private Gy_PersonMapper gy_PersonMapper;
	
	@Autowired
	private KaoQinMapper kaoqinMapper;

	@Override
	public int deleteById(Long id) {
		try {
			kaoqinMapper.deleteKaoqinByPersonId(id.intValue());
		}catch(Exception e) {
			e.printStackTrace();
		}
		return gy_PersonMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(Gy_Person record) {
		return gy_PersonMapper.insert(record);
	}

	@Override
	public int updateByPrimaryKey(Gy_Person record) {
		return gy_PersonMapper.updateByPrimaryKey(record);
	}

	@Override
	public int updateByActive(Gy_Person record) {
		return gy_PersonMapper.updateByActive(record);
	}

	@Override
	public int updateById(Gy_PersonVo record) {
		return gy_PersonMapper.updateById(record);
	}

	@Override
	public int selectPersonCodeHasExist(String personCode) {
		// TODO Auto-generated method stub
		return gy_PersonMapper.selectPersonCodeHasExist(personCode);
	}

}
